//package expressaoevolutiva;

public class Chromossome
{
    private Gen[] locus;
    private int size;
    
    //private double si = 1.5;
	
	double[] si;


    public Chromossome(int size)
    {
        locus = new Gen[size];
        
        si = new double[size];
        
        setSize(size);
        for (int i=0; i<getSize(); i++)
        {
        	setGenAt(i, new Gen()) ;
        	setSiAt(i,1);
        }

    }

	public int getSize()
	{
		return size;
	}

	public void setSize(int value)
	{
		this.size = value;
	}

	public Gen getGenAt(int pos)
    {
        return locus[pos];
    }

    public void setGenAt(int pos, Gen newGen)
    {
        locus[pos] = newGen;
    }
    
    public double getSiAt(int pos)
    {
    	return si[pos];
    }
    
    public void setSiAt(int pos, double value)
    {
    	si[pos] = value;
    }

    public double[] getX()
    {
    	double[] X = new double[getSize()];

    	for(int i=0; i<X.length; i++)
    	{
    		X[i] = getGenAt(i).getValue();
    	}

    	return X;
    }

    public String toString()
    {
    	String res = "(";

    	for (int i=0; i<getSize(); i++)
    	{
    		res += String.valueOf(getGenAt(i).getValue()) + ",";
    	}

    	res += "\b)";

    	return res;
    }

}